/**
 * OEM端的接口
 *
 * @Author: baiyuxin
 * @Date: 2019-9-10
 * @Last Modified by:   baiyuxin
 * @Last Modified time: 2019-9-10 14:26:34
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

//OEM端

//查询全部列表（自定义数据过滤）@0
export const findAllPage = params => {
  return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject`, {
    params,
    menuId: '-1'
  });
}

//查询全部列表（自定义数据过滤，无分页）@0.1
export const findAllList = params => {
  return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject/list`, {
    params,
    menuId: '-1'
  });
}


//事业部审核@1
export const findReviewPage = params => {
  let paramAssign = Object.assign({}, {
    projectStatus: types.PROJECT_STATUS_REVIEW
  }, params);
  return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject`, {
    params: paramAssign,
    menuId: '-1'
  });
}

//事业部部长审核@2
export const findLeaderReviewPage = params => {
  let paramAssign = Object.assign({}, {
    projectStatus: types.PROJECT_STATUS_DEP_REVIEW
  }, params);
  return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject`, {
    params: paramAssign,
    menuId: '-1'
  });
}

//部总监审核@3 整合后状态传25161002
export const findDirectorReviewPage = params => {
  let paramAssign = Object.assign({}, {
    projectStatus: types.PROJECT_STATUS_REVIEW
  }, params);
  return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject`, {
    params: paramAssign,
    menuId: '-1'
  });
}

//详情(包含子列表和审核内容)
export const getReview = (id, params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject/${id}`, {
  params,
  menuId: '-1'
});

//保存审核信息
export const saveReview = params => axios.post(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProjectCheck/save/examine`, params);

//导出
export const downloadExcel = params => {
  params = Object.assign(params, {
    menuId: '-1'
  });
  return axios({
    url: `${SERVER.CMSCLOUD_BIGCUSTOMER}/major/oem/majorProject/export/excel`,
    method: 'get',
    params: params,
    responseType: 'blob',
    //10分钟
    timeout: (10 * 1000) * 60
  });
};
